<template>
    <div>
        <p>{{ newNum }}
            <br/>
            {{ newUser }}
        </p>
        <button @click="user.job = 'javaEE'">java升级成javaEE</button>
        <ul>
            <li v-for="(item,index) in newList" :key='index'>
                <h3>
                    {{ item.name }}
                    <ul>
                        <li v-for="(_item,_index) in item.children" :key="_index">
                            {{ _item.name }}
                        </li>
                    </ul>
                </h3>
            </li>
        </ul>
    </div>
</template>
<script>
export default {
    data(){
        //1.纯数字前面加一个￥
        //2.后端给的独享，前端需要拼接成一个字符串
        //3.对一个数组进行处理,如过滤
        return {
            list:[
                {
                id:'0',
                name:'北京',
                children:[{id:"001",name:'朝阳'}]
                },
                {
                id:'1',
                name:'南京',
                children:[{id:"101",name:'羽化'}]
                },
                {
                id:'2',
                name:'西安',
                children:[{id:"201",name:'大雁塔'}]
                },
            ],
            num:199,
            user:{
                name:"小李",
                age:26,
                job:"java"
            }
        }
    },
    computed:{
        newUser(){

            console.log(1);
            // const {name,age,job} = this.user;
            const {name,age,job}=this.user;

            return name+'今年'+age+'岁了'+'工作是'+job;
        },
        newNum(){
           return  '￥' + this.num
        },
        newList(){
            //把id为0的过滤掉
            return this.list
        }
    }
}
</script>